import App from './App'

// 引入全局存储
import store from '@/store';

// 引入全局方法
import $mAssetsPath from '@/config/assets.config.js';
import $mConstDataConfig from '@/config/constData.config.js';
import $mSettingConfig from '@/config/setting.config.js';
import minRouterConfig from '@/config/min.router.config.js';
import routerConfig from '@/config/router.config.js';
import $api from '@/api/product.js';
import $uy from '@/utils/utils.js';

// 挂载全局自定以方法
Vue.prototype.$mStore = store;
Vue.prototype.$api = $api;
Vue.prototype.$uy = $uy;

Vue.use(minRouterConfig)

Vue.mixin({
	computed: {
		themeColor: {
			get() {
				return store.getters.themeColor;
			},
			set(val) {
				store.state.themeColor = val;
			}
		},
		$mConstDataConfig: {
			get() {
				return $mConstDataConfig
			},
			set(key, val) {
				$mConstDataConfig[key] = val;
			}
		},
		$mAssetsPath: {
			get() {
				return $mAssetsPath
			}
		},
		$uy: {
			get() {
				return $uy
			}
		}
	}
});

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App,
	store,
	routerConfig
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif